package com.example.myapplication10.DTO;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.myapplication10.DTO.CityInfoDTO;
import com.example.myapplication10.DTO.DataDTO;

public class WeatherDTO {
    @JSONField(name = "status")
    private Integer status;
    @JSONField(name = "date")
    private String date;
    @JSONField(name = "time")
    private String time;
    @JSONField(name = "cityInfo")
    private CityInfoDTO cityInfo;
    @JSONField(name = "data")
    private DataDTO data;

//    public void strInitialize(String strData,String strCityInfo){
//        if(status == 200) {
//            JSONObject object = JSONObject.parseObject(strCityInfo);
//            cityInfo = object.toJavaObject(CityInfoDTO.class);
//            object = JSONObject.parseObject(strData);
//            data = object.toJavaObject(DataDTO.class);
//            data.strInitialize(strData);
//        }
//    }
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getDate() {
        return status!=200?"接口无法访问！":date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTime() {
        return status!=200?"接口无法访问！":time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public CityInfoDTO getCityInfo() {
        return cityInfo;
    }

    public void setCityInfo(CityInfoDTO cityInfo) {
        if(status == 200) {
            this.cityInfo = cityInfo;
        }
    }

    public DataDTO getData() {
        return data;
    }

    public void setData(DataDTO data) {
        if(status == 200) {
            this.data = data;
        }
    }
}
